<template>
  <div :style="{
    margin: isBorder ? 0 : `-1px`
  }">
    <el-table :data="tbody" border size="small" :style="{
      width: `100%`,
    }" max-height="40vh" v-loading="loading">
      <el-table-column type="index" label="序号" align="center" width="70" />
      <el-table-column :width="item.width" show-overflow-tooltip :align="item.align" :min-width="120"
        :property="item.prop" :label="item.label" v-for="item in thead">
        <template #default="scope" v-if="$slots[item.prop] || item.formType || item.label.includes('日期')">
          <template v-if="$slots[item.prop]">
            <slot :name="item.prop" :row="scope.row" :index="scope.$index" />
          </template>
          <template v-else-if="item.label.includes('日期')">
              {{ proxy.$day(scope.row[item.prop]) }}
          </template>
          <template v-else-if="item.formType === 'copy'">
            <CopyText :data="scope.row[item.prop]" />
          </template>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script setup lang="ts">
//获取当前实例
import { getCurrentInstance, onMounted, ref } from 'vue';
const { proxy } = getCurrentInstance() as any;
//获取父级数据
const props = withDefaults(
  defineProps<{
    tbody?: any; //列表数据
    thead?: any; //表头
    loading?: boolean; //加载数据
    isBorder?: boolean; //加载数据
  }>(),
  {
    tbody: [],
    thead: [],
    isBorder: true,
  },
);

onMounted(() => {
});
</script>
<style scoped lang="scss"></style>
